﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogManager.Base;
using LogManager.Base.Windows;
using Raven.Client.Indexes;

namespace LogManager.Storage.Indexes
{
    /// <summary>
    /// Index to get all of type ievent
    /// note: http://www.philliphaydon.com/2011/12/ravendb-inheritance-revisited/
    /// </summary>
    class AllEvents : AbstractMultiMapIndexCreationTask
    {
        public AllEvents()
        {
            var t = typeof (IEvent);
            AddMap<WindowsLogEvent>(
                wevents => wevents.Select(we => new
                                                    {
                                                        we.Id,
                                                        we.Message, 
                                                        we.Log, 
                                                        we.User, 
                                                        we.TimeStamp, 
                                                        we.Level
                                                    }));
        }
    }
}
